package com.bigShen.pattern.strategy.main;

import com.bigShen.pattern.strategy.pay.Order;
import com.bigShen.pattern.strategy.pay.PayType;
import com.bigShen.pattern.strategy.pay.fact.PayFactType;
import com.bigShen.pattern.strategy.pay.impl.UnionPay;

/**
 * @author: lei.shen
 * @date: 2018/10/5
 */
public class StrategyMainTest {

    public static void main(String[] args) {

        Order order = new Order("1", "201810051221002", 356.5);

        System.out.println("-- 旧的支付方式");
        System.out.println(order.payOld(new UnionPay()));

        System.out.println("-- 抽象工厂方式");
        System.out.println(order.payByFactory(PayFactType.WECHAT_PAY));

        System.out.println("-- 枚举类型,新的支付方式");
        // 枚举方式, 省去了 switch, if else 等逻辑判断
        System.out.println(order.pay(PayType.ALI_PAY));



    }

}
